<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>信息管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#btnImport").click(function(){
				$.jBox($("#importBox").html(), {title:"导入信息登记", buttons:{"关闭":true}, 
					bottomText:"导入文件不能超过5M，仅允许导入“doc文件”！"});
			});
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		
		function yanqi(id){
			$("#id").val(id);
			$('#demoModal').modal('show');
		}
		
		function shangchuan(){
			var id=$("#id").val();
			var time=$("#time").val();
			var yuan=$("#yuan").val();
			if(time!=null&&time!=''){
				if(!isNaN(time)){
					$("#formdatayan").submit();
				
				}else{
					alert("只可以输入数字");
				}
			}else{
				alert("延期天数不可为空");
			}
		}
		function jqchk(){ //jquery获取复选框值,并且拼接成字符串
			var chk_value =[];
			var chk='('; 
			$('input[name="checkbox"]:checked').each(function(){
			chk_value.push($(this).val());
			});
			if(chk_value.length==0){
				alert('你还没有选择任何数据');
			}else{
				for(var i=0;i<chk_value.length;i++){
					if(i==(chk_value.length-1)){
						chk +="'"+chk_value[i]+"'"
					}else{
						chk +="'"+chk_value[i]+"',"
					}
				}
			}
			 chk += ')'; 
			 top.$.jBox.confirm("确认要导出选中数据吗？","系统提示",function(v,h,f){
					if(v=="ok"){
						/* $("#searchForm").attr("action","${ctx}/sys/user/export?id=" );
						$("#searchForm").submit(); */
						 location.href="${ctx}/numberinfo/yhcgNumberinfo/export?uid="+chk; 
					}
				},{buttonsFocus:1});
				top.$('.jbox-body .jbox-icon').css('top','55px');
			} 
		
		function setjq(){
			var chknum = $("input[name='checkbox']").size();//选项总个数 
		    var chk = 0; 
		    $("input[name='checkbox']").each(function () { 
		      if ($(this).attr("checked")) { 
		        chk++; 
		      } 
		    }); 
			if(chk==1) { // 全选
				$("input[name='checkbox']").each(function() {
				$(this).attr("checked", true);
				});
				} else { // 取消全选
				$("input[name='checkbox']").each(function() {
				$(this).attr("checked", false);
				});
				}
		}
	</script>
</head>
<body>

	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/numberinfo/yhcgNumberinfo/listxin">城管信息查询</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="yhcgNumberinfo" action="${ctx}/numberinfo/yhcgNumberinfo/listxin" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>编号：</label>
				<form:input path="number" htmlEscape="false" maxlength="255" class="input-medium"/>
			</li>
			<li><label>来源：</label>
				<form:select path="come" class="input-medium required"   type="select[disabled]">
					<form:option value="">请选择</form:option>
					<form:options items="${fns:getDictList('come_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			<li>
			<label>事件类别:</label>
			<form:select path="type" class="input-medium required">
					<form:option value="">请选择</form:option>
					<form:options items="${fns:getDictList('type_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			<li>
			<label>责任单位:</label>
			<form:select  path="responsibilityunit" class="input-medium" >
				
					<form:options items="${list}" itemLabel="name" itemValue="id" htmlEscape="false"/>
					<form:option value="">请选择</form:option>
				</form:select>
			</li>
			 <li><label>处理时间:</label>
				<input name="startshentime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate "
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});" id="tid"/>
					至
					<input name="endshentime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate "
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});" id="tid"/>
					</li>
						<li>
			<label>督办单位:</label>
			<form:select  path="supervisionunit" class="input-medium" >
				
					<form:options items="${list1}" itemLabel="name" itemValue="id" htmlEscape="false"/>
					<form:option value="">请选择</form:option>
				</form:select>
			</li>
			<li>
			&nbsp;&nbsp;&nbsp;&nbsp;<label>处理结果:</label>
			<form:select  path="status" class="input-medium" >
					<form:option value="">请选择</form:option>
					<form:option value="0">待处理</form:option>
					<form:option value="2">待复核</form:option>
					<form:option value="3">待结案</form:option>
					<form:option value="4">已结案</form:option>
				</form:select>
			</li>
			<li><label>转办时间:</label>
				<input name="starttime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate "
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});" id="tid"/>
					至
					<input name="endtime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate "
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});" id="tid"/>
					</li>
		
			<li><label>关键字：</label>
				<form:input path="content" htmlEscape="false" class="input-medium"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
			<input id="btnSubmitdao" class="btn btn-primary" type="button" value="导出" onclick="jqchk()"/>
							<!-- <input id="btnImport" class="btn btn-primary" type="button" value="导入"/> -->
			</li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th><input type="checkbox" name="checkbox" onclick="setjq()"></th>
				<th>登记编号</th>
				<th>来源</th>
				<th>事件类别</th>
				<th>转办时间</th>
				<th>还剩天数</th>
				<th>主要内容</th>
				<th>责任单位</th>
				<th>督办单位</th>
				<th>处理结果</th>
				<th>查看</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="yhcgNumberinfo">
			<tr>
				<td><input type="checkbox" value="${yhcgNumberinfo.id}" name="checkbox"></td>
				<td>
					${yhcgNumberinfo.number}
				</td>
				<td>
					${fns:getDictLabel(yhcgNumberinfo.come, 'come_type', '')}
				</td>
				<td>
					${fns:getDictLabel(yhcgNumberinfo.type, 'type_type', '')}
				</td>
				<td>
				<fmt:formatDate value="${yhcgNumberinfo.createtime}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
				${fns:DateList(yhcgNumberinfo.timelimit, '')}
				</td>
				<td>
				<span title="${yhcgNumberinfo.content}" >${fn:substring(yhcgNumberinfo.content, 0, 10)}</span>	
				</td>
				<td>
					${yhcgNumberinfo.zenname}
				</td>
				<td>
					${yhcgNumberinfo.duname}
				</td>
				<td>
				${fns:getDictLabel(yhcgNumberinfo.status, 'status', '')}
				</td>
				<%-- <shiro:hasPermission name="numberinfo:yhcgNumberinfo:edit"> --%><td>
				<a href="${ctx}/numberinfo/yhcgNumberinfo/formchakan?id=${yhcgNumberinfo.id}">查看</a>
				<!-- 判断页面权限。管理员可以全部延期，督查单位可以延期他督查的，自己可以申请延期自己的 -->
				<%-- 	<c:if test="${yhcgNumberinfo.status==1 }">
					<c:if test="${(us.isAdmin()==true)||(us.getOffice().getId()==yhcgNumberinfo.responsibilityunit)||(us.getOffice().getParentId()==yhcgNumberinfo.supervisionunit)}">
					<a href="${ctx}/numberinfo/yhcgNumberinfo/formdatayan?id=${yhcgNumberinfo.id}">延期</a>
				<a onclick="yanqi('${yhcgNumberinfo.id}')"  style="cursor:pointer;">延期</a>
					</c:if>
					</c:if>
					<c:if test="${yhcgNumberinfo.status==0}">
					<c:if test="${(us.getOffice().getId()==yhcgNumberinfo.responsibilityunit)}">
					<a href="${ctx}/numberinfo/yhcgNumberinfo/formdatachu?id=${yhcgNumberinfo.id}" onclick="return confirmx('确认要处理该工单吗？', this.href)">处理</a>
					</c:if>
					</c:if>
					<c:if test="${yhcgNumberinfo.status==1}">
					<c:if test="${(us.getOffice().getId()==yhcgNumberinfo.responsibilityunit)}">
					<a href="${ctx}/numberinfo/yhcgNumberinfo/formdatachu?id=${yhcgNumberinfo.id}">完成</a>
					</c:if>
					</c:if>
					<c:if test="${yhcgNumberinfo.status==2}">
					<c:if test="${(us.getOffice().getParentId()==yhcgNumberinfo.supervisionunit)}">
					<a href="${ctx}/numberinfo/yhcgNumberinfo/formdatafu?id=${yhcgNumberinfo.id}">复核</a>
					</c:if>
					</c:if>
					<c:if test="${yhcgNumberinfo.status==3}">
					<c:if test="${us.isAdmin()==true}">
					<a href="${ctx}/numberinfo/yhcgNumberinfo/formdatajie?id=${yhcgNumberinfo.id}">结案</a>
					</c:if>
					</c:if>
    				<a href="${ctx}/numberinfo/yhcgNumberinfo/form?id=${yhcgNumberinfo.id}">修改</a>
    				<c:if test="${(us.getOffice().getId()==yhcgNumberinfo.responsibilityunit)||(us.getOffice().getParentId()==yhcgNumberinfo.supervisionunit)}">
					<a href="${ctx}/numberinfo/yhcgNumberinfo/delete?id=${yhcgNumberinfo.id}" onclick="return confirmx('确认要删除该工单吗？', this.href)">删除</a>
					</c:if> --%>
				</td><%-- </shiro:hasPermission> --%>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>